import { categoryAdd,categoryList } from "@/api/category.js";
export default {
    state: {
        categoryaddlist: [],
        categorylist:{}
    },
    mutations: {
        changeCategoryaddlist(state, data) {
            state.categoryaddlist = data;
        },
        changeCategorylist(state, data) {
            state.categorylist = data;
            // console.log(data);
        }
    },
    actions: {
        async actchangeCategoryaddlist(context) {
            let reslult = await categoryAdd();
            // console.log(reslult.data.data);
            if (reslult) {
                context.commit("changeCategoryaddlist", reslult.data.data);
            }
        },
        async actchangeCategorylist(context,params) {
            let reslult = await categoryList(params);
            // console.log(reslult.data.data);
            if (reslult) {
                context.commit("changeCategorylist", reslult.data);
            }
            
        }
    }
}